<!-- 入院检查 实验室检查（术前） LaboratoryExamination -->
<template>
  <div class="page-center">
    <div class="medical-form">
      <el-form :model="formData" label-width="160px" class="info-form" label-position="right">
        <el-divider content-position="left">
          <h3>实验室检查（术前）</h3>
        </el-divider>

        <!-- 血常规检查 -->
        <el-row v-if="formData.bloodExams && formData.bloodExams.length > 0" :gutter="12">
          <el-col :span="24">
            <el-card class="box-card" shadow="never">
              <div slot="header" class="clearfix">
                <span>血常规检查</span>
              </div>
              <div
                v-for="(exam, index) in formData.bloodExams"
                :key="exam.bloodExamId"
                class="exam-section"
                :class="getExamSectionClass(index)"
              >
                <!-- 基本信息 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="病案号">
                      <div class="display-value info-value">{{ display(exam.medicalRecordNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="样本号">
                      <div class="display-value info-value">{{ display(exam.sampleNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="条码号">
                      <div class="display-value info-value">{{ display(exam.barcodeNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="样本类型">
                      <div class="display-value info-value">{{ display(exam.sampleType) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="科室">
                      <div class="display-value info-value">{{ display(exam.department) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="病区">
                      <div class="display-value info-value">{{ display(exam.ward) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="床号">
                      <div class="display-value info-value">{{ display(exam.bedNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="姓名">
                      <div class="display-value info-value">{{ display(exam.name) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="性别">
                      <div class="display-value info-value">{{ display(exam.gender) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="年龄">
                      <div class="display-value info-value">{{ display(exam.age) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="24">
                    <el-form-item label="临床诊断">
                      <div class="display-value info-value">{{ display(exam.clinicalDiagnosis) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="10">
                    <el-form-item label="采集时间">
                      <div class="display-value info-value">{{ display(exam.collectionTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="接收时间">
                      <div class="display-value info-value">{{ display(exam.receiveTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="审核时间">
                      <div class="display-value info-value">{{ display(exam.reviewTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 血常规具体指标 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="血常规五分类">
                      <div class="display-value info-value">{{ display(exam.fivePart) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="检验项目">
                      <div class="display-value info-value">{{ display(exam.testItem) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="检测方法">
                      <div class="display-value info-value">{{ display(exam.detectionMethod) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 白细胞相关 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="白细胞计数">
                      <div class="display-value info-value">{{ display(exam.whiteBloodCellCount) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="中性粒百分数">
                      <div class="display-value info-value">{{ display(exam.neutrophilPercentage) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="中性粒绝对值">
                      <div class="display-value info-value">{{ display(exam.neutrophilAbsolute) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="淋巴百分数">
                      <div class="display-value info-value">{{ display(exam.lymphocytePercentage) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="淋巴绝对值">
                      <div class="display-value info-value">{{ display(exam.lymphocyteAbsolute) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="单核百分数">
                      <div class="display-value info-value">{{ display(exam.monocytePercentage) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="单核绝对值">
                      <div class="display-value info-value">{{ display(exam.monocyteAbsolute) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="嗜酸性粒百分数">
                      <div class="display-value info-value">{{ display(exam.eosinophilPercentage) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="嗜酸性粒绝对值">
                      <div class="display-value info-value">{{ display(exam.eosinophilAbsolute) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="嗜碱性粒百分数">
                      <div class="display-value info-value">{{ display(exam.basophilPercentage) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="嗜碱性粒绝对值">
                      <div class="display-value info-value">{{ display(exam.basophilAbsolute) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 红细胞相关 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="红细胞计数">
                      <div class="display-value info-value">{{ display(exam.redBloodCellCount) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="血红蛋白量">
                      <div class="display-value info-value">{{ display(exam.hemoglobin) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="红细胞比积">
                      <div class="display-value info-value">{{ display(exam.hematocrit) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="平均红细胞体积">
                      <div class="display-value info-value">{{ display(exam.meanCorpuscularVolume) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="平均红细胞血红蛋白量">
                      <div class="display-value info-value">{{ display(exam.meanCorpuscularHemoglobin) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="平均血红蛋白浓度">
                      <div class="display-value info-value">{{ display(exam.meanCorpuscularHemoglobinConcentration) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="RBC体积分布宽度">
                      <div class="display-value info-value">{{ display(exam.redCellDistributionWidth) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="RBC体积分布SD值">
                      <div class="display-value info-value">{{ display(exam.redCellDistributionSd) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 血小板相关 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="血小板计数">
                      <div class="display-value info-value">{{ display(exam.plateletCount) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="血小板压积">
                      <div class="display-value info-value">{{ display(exam.plateletCrit) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="平均血小板体积">
                      <div class="display-value info-value">{{ display(exam.meanPlateletVolume) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="血小板分布SD值">
                      <div class="display-value info-value">{{ display(exam.plateletDistributionSd) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="大型血小板比率">
                      <div class="display-value info-value">{{ display(exam.largePlateletRatio) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-divider v-if="index < formData.bloodExams.length - 1" />
              </div>
            </el-card>
          </el-col>
        </el-row>

        <!-- 血型检查 -->
        <el-row v-if="formData.bloodTypeExams && formData.bloodTypeExams.length > 0" :gutter="12" style="margin-top: 16px;">
          <el-col :span="24">
            <el-card class="box-card" shadow="never">
              <div slot="header" class="clearfix">
                <span>血型检查</span>
              </div>
              <div
                v-for="(exam, index) in formData.bloodTypeExams"
                :key="exam.id"
                class="exam-section"
                :class="getExamSectionClass(index)"
              >
                <!-- 基本信息 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="病案号">
                      <div class="display-value info-value">{{ display(exam.medicalRecordNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="样本号">
                      <div class="display-value info-value">{{ display(exam.sampleNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="条码号">
                      <div class="display-value info-value">{{ display(exam.barcodeNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="样本类型">
                      <div class="display-value info-value">{{ display(exam.sampleType) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="科室">
                      <div class="display-value info-value">{{ display(exam.department) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="临床诊断">
                      <div class="display-value info-value">{{ display(exam.clinicalDiagnosis) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="姓名">
                      <div class="display-value info-value">{{ display(exam.name) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="性别">
                      <div class="display-value info-value">{{ display(exam.gender) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="年龄">
                      <div class="display-value info-value">{{ display(exam.age) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="采集时间">
                      <div class="display-value info-value">{{ display(exam.collectionTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="10">
                    <el-form-item label="接收时间">
                      <div class="display-value info-value">{{ display(exam.receiveTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="审核时间">
                      <div class="display-value info-value">{{ display(exam.reviewTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 血型具体指标 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="检验项目">
                      <div class="display-value info-value">{{ display(exam.testItem) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="ABO血型">
                      <div class="display-value info-value">{{ display(exam.aboBloodType) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="RhD血型筛查">
                      <div class="display-value info-value">{{ display(exam.rhDBloodTypeScreening) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="反定型">
                      <div class="display-value info-value">{{ display(exam.reverseTyping) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="Rh血型弱D确认">
                      <div class="display-value info-value">{{ display(exam.rhWeakDConfirmation) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="红细胞单特异性抗体">
                      <div class="display-value info-value">{{ display(exam.redCellMonospecificAntibody) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="Rh血型C抗原">
                      <div class="display-value info-value">{{ display(exam.rhCAntigen) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="Rh血型c抗原">
                      <div class="display-value info-value">{{ display(exam.rhCAntigenLower) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="Rh血型E抗原">
                      <div class="display-value info-value">{{ display(exam.rhEAntigen) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="Rh血型e抗原">
                      <div class="display-value info-value">{{ display(exam.rhEAntigenLower) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-divider v-if="index < formData.bloodTypeExams.length - 1" />
              </div>
            </el-card>
          </el-col>
        </el-row>

        <!-- 凝血功能 -->
        <el-row v-if="formData.coagulationExams && formData.coagulationExams.length > 0" :gutter="12" style="margin-top: 16px;">
          <el-col :span="24">
            <el-card class="box-card" shadow="never">
              <div slot="header" class="clearfix">
                <span>凝血功能检查</span>
              </div>
              <div
                v-for="(exam, index) in formData.coagulationExams"
                :key="exam.id"
                class="exam-section"
                :class="getExamSectionClass(index)"
              >
                <!-- 基本信息 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="病案号">
                      <div class="display-value info-value">{{ display(exam.medicalRecordNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="样本号">
                      <div class="display-value info-value">{{ display(exam.sampleNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="条码号">
                      <div class="display-value info-value">{{ display(exam.barcodeNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="样本类型">
                      <div class="display-value info-value">{{ display(exam.sampleType) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="科室">
                      <div class="display-value info-value">{{ display(exam.department) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="临床诊断">
                      <div class="display-value info-value">{{ display(exam.clinicalDiagnosis) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="姓名">
                      <div class="display-value info-value">{{ display(exam.name) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="性别">
                      <div class="display-value info-value">{{ display(exam.gender) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="年龄">
                      <div class="display-value info-value">{{ display(exam.age) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="采集时间">
                      <div class="display-value info-value">{{ display(exam.collectionTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="10">
                    <el-form-item label="接收时间">
                      <div class="display-value info-value">{{ display(exam.receiveTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="审核时间">
                      <div class="display-value info-value">{{ display(exam.reviewTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 凝血功能具体指标 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="检验项目">
                      <div class="display-value info-value">{{ display(exam.testItem) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="凝血酶原时间">
                      <div class="display-value info-value">{{ display(exam.prothrombinTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="凝血酶原活动度">
                      <div class="display-value info-value">{{ display(exam.prothrombinActivity) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="国际标准化比值">
                      <div class="display-value info-value">{{ display(exam.internationalNormalizedRatio) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="纤维蛋白原">
                      <div class="display-value info-value">{{ display(exam.fibrinogen) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="活化部分凝血活酶时间">
                      <div class="display-value info-value">{{ display(exam.activatedPartialThromboplastinTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="APTT比值">
                      <div class="display-value info-value">{{ display(exam.apttRatio) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="凝血酶时间">
                      <div class="display-value info-value">{{ display(exam.thrombinTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="凝血酶时间比值">
                      <div class="display-value info-value">{{ display(exam.thrombinTimeRatio) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-divider v-if="index < formData.coagulationExams.length - 1" />
              </div>
            </el-card>
          </el-col>
        </el-row>

        <!-- 生化检查 -->
        <el-row v-if="formData.biochemistryExams && formData.biochemistryExams.length > 0" :gutter="12" style="margin-top: 16px;">
          <el-col :span="24">
            <el-card class="box-card" shadow="never">
              <div slot="header" class="clearfix">
                <span>生化检查</span>
              </div>
              <div
                v-for="(exam, index) in formData.biochemistryExams"
                :key="exam.id"
                class="exam-section"
                :class="getExamSectionClass(index)"
              >
                <!-- 基本信息 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="病案号">
                      <div class="display-value info-value">{{ display(exam.medicalRecordNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="样本号">
                      <div class="display-value info-value">{{ display(exam.sampleNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="条码号">
                      <div class="display-value info-value">{{ display(exam.barcodeNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="样本类型">
                      <div class="display-value info-value">{{ display(exam.sampleType) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="病区">
                      <div class="display-value info-value">{{ display(exam.ward) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="床号">
                      <div class="display-value info-value">{{ display(exam.bedNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="24">
                    <el-form-item label="临床诊断">
                      <div class="display-value info-value">{{ display(exam.clinicalDiagnosis) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="姓名">
                      <div class="display-value info-value">{{ display(exam.name) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="性别">
                      <div class="display-value info-value">{{ display(exam.gender) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="年龄">
                      <div class="display-value info-value">{{ display(exam.age) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="采集时间">
                      <div class="display-value info-value">{{ display(exam.collectionTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="10">
                    <el-form-item label="接收时间">
                      <div class="display-value info-value">{{ display(exam.receiveTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="审核时间">
                      <div class="display-value info-value">{{ display(exam.reviewTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="检测方法">
                      <div class="display-value info-value">{{ display(exam.detectionMethod) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 生化具体指标 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="检验项目">
                      <div class="display-value info-value">{{ display(exam.testItem) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 蛋白质相关 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="总蛋白">
                      <div class="display-value info-value">{{ display(exam.totalProtein) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="白蛋白">
                      <div class="display-value info-value">{{ display(exam.albumin) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="球蛋白">
                      <div class="display-value info-value">{{ display(exam.globulin) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="白球蛋白比值">
                      <div class="display-value info-value">{{ display(exam.albuminGlobulinRatio) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 肝功能 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="总胆红素">
                      <div class="display-value info-value">{{ display(exam.totalBilirubin) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="直接胆红素">
                      <div class="display-value info-value">{{ display(exam.directBilirubin) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="间接胆红素">
                      <div class="display-value info-value">{{ display(exam.indirectBilirubin) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="丙氨酸氨基转移酶">
                      <div class="display-value info-value">{{ display(exam.alanineAminotransferase) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="天冬氨酸氨基转移酶">
                      <div class="display-value info-value">{{ display(exam.aspartateAminotransferase) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="谷丙谷草比值">
                      <div class="display-value info-value">{{ display(exam.altAstRatio) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 肾功能 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="尿素">
                      <div class="display-value info-value">{{ display(exam.urea) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="肌酐(酶法)">
                      <div class="display-value info-value">{{ display(exam.creatinine) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="eGFR(估算值)">
                      <div class="display-value info-value">{{ display(exam.egfr) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="尿素肌酐比值">
                      <div class="display-value info-value">{{ display(exam.ureaCreatinineRatio) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="尿酸">
                      <div class="display-value info-value">{{ display(exam.uricAcid) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 血糖电解质 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="葡萄糖">
                      <div class="display-value info-value">{{ display(exam.glucose) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="钾">
                      <div class="display-value info-value">{{ display(exam.potassium) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="钠">
                      <div class="display-value info-value">{{ display(exam.sodium) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="氯">
                      <div class="display-value info-value">{{ display(exam.chloride) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 血脂 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="总胆固醇">
                      <div class="display-value info-value">{{ display(exam.totalCholesterol) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="甘油三酯">
                      <div class="display-value info-value">{{ display(exam.triglyceride) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="高密度脂蛋白胆固醇">
                      <div class="display-value info-value">{{ display(exam.hdlCholesterol) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="低密度脂蛋白胆固醇">
                      <div class="display-value info-value">{{ display(exam.ldlCholesterol) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="非HDL-C">
                      <div class="display-value info-value">{{ display(exam.nonHdlCholesterol) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="载脂蛋白AI">
                      <div class="display-value info-value">{{ display(exam.apolipoproteinAi) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="载脂蛋白B">
                      <div class="display-value info-value">{{ display(exam.apolipoproteinB) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="脂蛋白(a)">
                      <div class="display-value info-value">{{ display(exam.lipoproteinA) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 其他字段 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="入院病房">
                      <div class="display-value info-value">{{ display(exam.admissionWard) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="入院床号">
                      <div class="display-value info-value">{{ display(exam.admissionBedNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="24">
                    <el-form-item label="LDL-C+AST+LP(a)+ApoAI+ApoB+生化筛查" label-width="300px">
                      <div class="display-value info-value">{{ display(exam.item1) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="24">
                    <el-form-item label="生化筛查+LDL-C+ApoAI+AST+ApoB+LP(a)" label-width="300px">
                      <div class="display-value info-value">{{ display(exam.item2) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-divider v-if="index < formData.biochemistryExams.length - 1" />
              </div>
            </el-card>
          </el-col>
        </el-row>

        <!-- 传染病检查 -->
        <el-row v-if="formData.infectiousDiseaseExams && formData.infectiousDiseaseExams.length > 0" :gutter="12" style="margin-top: 16px;">
          <el-col :span="24">
            <el-card class="box-card" shadow="never">
              <div slot="header" class="clearfix">
                <span>传染病检查</span>
              </div>
              <div
                v-for="(exam, index) in formData.infectiousDiseaseExams"
                :key="exam.id"
                class="exam-section"
                :class="getExamSectionClass(index)"
              >
                <!-- 基本信息 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="病案号">
                      <div class="display-value info-value">{{ display(exam.medicalRecordNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="样本号">
                      <div class="display-value info-value">{{ display(exam.sampleNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="条码号">
                      <div class="display-value info-value">{{ display(exam.barcodeNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="样本类型">
                      <div class="display-value info-value">{{ display(exam.sampleType) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="科室">
                      <div class="display-value info-value">{{ display(exam.department) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="临床诊断">
                      <div class="display-value info-value">{{ display(exam.clinicalDiagnosis) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="姓名">
                      <div class="display-value info-value">{{ display(exam.name) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="性别">
                      <div class="display-value info-value">{{ display(exam.gender) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="年龄">
                      <div class="display-value info-value">{{ display(exam.age) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="采集时间">
                      <div class="display-value info-value">{{ display(exam.collectionTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="10">
                    <el-form-item label="接收时间">
                      <div class="display-value info-value">{{ display(exam.receiveTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="审核时间">
                      <div class="display-value info-value">{{ display(exam.reviewTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 传染病具体指标 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="检验项目">
                      <div class="display-value info-value">{{ display(exam.testItem) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="梅毒+HIV+HCV发光">
                      <div class="display-value info-value">{{ display(exam.syphilisHivHcvLuminescence) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="抗HIV抗体">
                      <div class="display-value info-value">{{ display(exam.antiHivAntibody) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="抗HCV抗体">
                      <div class="display-value info-value">{{ display(exam.antiHcvAntibody) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="抗梅毒螺旋体抗体">
                      <div class="display-value info-value">{{ display(exam.antiTreponemaPallidumAntibody) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-divider v-if="index < formData.infectiousDiseaseExams.length - 1" />
              </div>
            </el-card>
          </el-col>
        </el-row>

        <!-- 乙肝五项 -->
        <el-row v-if="formData.hepatitisBExams && formData.hepatitisBExams.length > 0" :gutter="12" style="margin-top: 16px;">
          <el-col :span="24">
            <el-card class="box-card" shadow="never">
              <div slot="header" class="clearfix">
                <span>乙肝五项检查</span>
              </div>
              <div
                v-for="(exam, index) in formData.hepatitisBExams"
                :key="exam.id"
                class="exam-section"
                :class="getExamSectionClass(index)"
              >
                <!-- 基本信息 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="病案号">
                      <div class="display-value info-value">{{ display(exam.medicalRecordNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="样本号">
                      <div class="display-value info-value">{{ display(exam.sampleNumber) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="条码号">
                      <div class="display-value info-value">{{ display(exam.barcodeNumber) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="样本类型">
                      <div class="display-value info-value">{{ display(exam.sampleType) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="科室">
                      <div class="display-value info-value">{{ display(exam.department) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="临床诊断">
                      <div class="display-value info-value">{{ display(exam.clinicalDiagnosis) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="姓名">
                      <div class="display-value info-value">{{ display(exam.name) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="性别">
                      <div class="display-value info-value">{{ display(exam.gender) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="年龄">
                      <div class="display-value info-value">{{ display(exam.age) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="采集时间">
                      <div class="display-value info-value">{{ display(exam.collectionTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="10">
                    <el-form-item label="接收时间">
                      <div class="display-value info-value">{{ display(exam.receiveTime) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="审核时间">
                      <div class="display-value info-value">{{ display(exam.reviewTime) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>

                <!-- 乙肝五项具体指标 -->
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="检验项目">
                      <div class="display-value info-value">{{ display(exam.testItem) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="HBsAg">
                      <div class="display-value info-value">{{ display(exam.hbsag) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="HBsAb">
                      <div class="display-value info-value">{{ display(exam.hbsab) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="HBeAg">
                      <div class="display-value info-value">{{ display(exam.hbeag) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="12">
                  <el-col :span="8">
                    <el-form-item label="HBeAb">
                      <div class="display-value info-value">{{ display(exam.hbeab) }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="HBcAb">
                      <div class="display-value info-value">{{ display(exam.hbcab) }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-divider v-if="index < formData.hepatitisBExams.length - 1" />
              </div>
            </el-card>
          </el-col>
        </el-row>
      </el-form>
    </div>
  </div>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'
import { simple } from '@/api/dataEntry/hospitalAdmissionCheckup'

export default {
  name: 'LaboratoryExamination',
  data() {
    return {
      formData: {
        bloodExams: [],
        bloodTypeExams: [],
        coagulationExams: [],
        biochemistryExams: [],
        infectiousDiseaseExams: [],
        hepatitisBExams: []
      },
      loading: false
    }
  },
  computed: {
    ...mapGetters('patient', ['robustPatientId', 'patientFallbackData'])
  },
  watch: {
    robustPatientId: {
      handler(newId) {
        if (newId) {
          this.loadData(newId)
        } else {
          this.resetForm()
        }
      },
      immediate: true
    }
  },
  async mounted() {
    if (!this.robustPatientId) {
      const restored = await this.restorePatientFromStorage()
      if (restored) {
        this.loadData(restored.id || restored.patientId)
      }
    }
  },
  methods: {
    ...mapActions('patient', ['restorePatientFromStorage']),

    async loadData(patientId) {
      if (this.loading) return

      this.loading = true
      try {
        const res = await simple({ recordId: patientId })
        this.handleResponseData(res)
      } catch (error) {
        console.error('加载实验室检查失败:', error)
        this.applyFallbackData()
      } finally {
        this.loading = false
      }
    },

    handleResponseData(res) {
      const payload = res?.data?.data ?? res?.data ?? res ?? {}

      if (payload && Object.keys(payload).length > 0) {
        this.formData = {
          ...this.formData,
          ...payload
        }
      }
    },

    applyFallbackData() {
      // 实验室检查数据通常没有回退数据，保持空状态
    },

    resetForm() {
      this.formData = {
        bloodExams: [],
        bloodTypeExams: [],
        coagulationExams: [],
        biochemistryExams: [],
        infectiousDiseaseExams: [],
        hepatitisBExams: []
      }
    },

    display(val) {
      if (val === null || val === undefined || String(val).trim() === '') return '-'
      return val
    },

    getExamSectionClass(index) {
      return index % 2 === 0 ? 'exam-section-even' : 'exam-section-odd'
    }
  }
}
</script>

<!-- 引入共享样式 -->
<style src="@/styles/shared.css"></style>

<style scoped>
/* 卡片标题样式增强 */
.box-card >>> .el-card__header {
  background: linear-gradient(135deg, #7b92f9 0%, #8d6de4 100%);
  color: white;
  font-weight: bold;
  padding: 12px 20px;
}
</style>
